<template>
    <el-select v-model="pData.zhi" filterable placeholder="请选择" clearable size="small"
               :disabled="pData.isEdit && pData.allowModification == 0">
        <el-option
                v-for="item in pData.selectObj"
                :key="item.value"
                :label="item.label"
                :value="item.value">
        </el-option>
    </el-select>
</template>

<script>
    import { ref, inject, watch } from "vue";
    export default {
      name: "selectSingle",
      props: {
          pData: Object
      },
      data() {
        return {
        }
      },
      watch: {
        'pData.zhi': {
          handler(newName, oldName) {
            let nameEn = this.pData.nameEn;
            let clickName = this.pData.onclickName;
            const data = {};
            data[nameEn] = newName;
            this.$emit(clickName, data)
          },
          deep: true,
        },
      },
      created() {},
      methods: {
        clearZhi() {
          this.pData.zhi = "";
        }
      },
    }
</script>

<style scoped>
    .el-select {
        width: 100%;
    }
</style>
